# -*- coding: utf-8 -*-
from django.http import HttpResponse, Http404
from django.shortcuts import render_to_response
import datetime
#from django.template import Template, Context
#import django.shortcuts.render_to_response
#from django.template.loader import get_template


def helloworld(request):
    return HttpResponse ("你好世界")



def hours_ahead(request, offset):
    try:
        offset = int(offset)
    except ValueError:
        raise Http404()
    dt = datetime.datetime.now() + datetime.timedelta(hours=offset)
#    html = "<html><body>In %s hours(s), it will be %s.</body></html>" % (offset, dt)
#    return HttpResponse(html)
    return render_to_response('hours_ahead.html', {'hour_offset':offset, 'next_time': dt})

def current_datetime(request):
    now = datetime.datetime.now()
    return render_to_response('current_datetime.html', {'current_date': now})

def display_meta(request):
    values = request.META.items()
    values.sort()
    return render_to_response('display_meta.html', {'meta_values':values})
    
    